<script setup>
import { ref } from 'vue';

const props = defineProps(['text'])

const isOpenModal = ref(false)

function openModal() {
    isOpenModal.value = true;
}
function closeModal() {
    isOpenModal.value = false
}

</script>

<template>
    <div class="info-container" >
        <button type="button" @click="openModal" >{{ props.text }}</button>
        <div class="modal" :class="{ open: isOpenModal }">
            <div class="content-container">
                <div class="content">
                    <div class="header">
                        <img src="/src/assets/images/student/close.svg" alt="Delete" @click="closeModal" />
                    </div>
                    <slot :closeModal="closeModal"></slot>
                </div>
            </div>
        </div>
    </div>
</template>

<style scoped >

.info-container>button {
    width: 162px;
    height: 40px;
    background-color: #8493a6;
    box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16);
    border-radius: 10px;
    color: #ffffff;
    font-family: Source Han Sans CN;
    font-size: 18px;
    line-height: 40px;
    color: #fafafa;
    border: none;
    user-select: none;
    cursor: pointer;
}

.info-container>button:hover {
    opacity: 0.85;
}

.info-container>button:active {
    transform: translateY(3px);
}

.info-container>.modal {
    display: none;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
    z-index: 20;
}

.info-container>.modal.open {
    display: block;
}

.info-container>.modal>.content-container {
    display: flex;
    width: 100%;
    /* height: 100%;*/
    justify-content: center;
    align-items: center;
}


.info-container>.modal>.content-container>.content {
    width: 780px;
    /*height: 491px;*/
    background-color: #ffffff;
    border: none;
    box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16);
    padding: 20px 54px;
    margin: 50px 0;
}

.info-container>.modal>.content-container>.content>.header {
    display: flex;
    justify-content: end;
    align-items: center;
}

.info-container>.modal>.content-container>.content>.header>img {
    cursor: pointer;
    user-select: none;
    transition: transform 0.25s;
}

.info-container>.modal>.content-container>.content>.header>img:hover {
    transform: rotate(90deg);
}


</style>